Kanzi legacy renderer interface. More...
#include <kanzi/core.ui/graphics/renderer.hpp>
Classes | |
| struct | RendererSettings |
| Settings structure for renderer construction. More... | |
Public Member Functions | |
| void | advanceGlobalTime (chrono::milliseconds deltaTime) |
| Advances the renderer wall clock with time delta. | |
| void | applyCameraMatrix (Matrix4x4 cameraProjectionMatrix, Matrix4x4 cameraViewMatrix, float near, float far) |
| Applies camera matrices to the renderer so that Kanzi can apply them as uniforms to shaders. | |
| void | beginFrame () |
| Begins rendering a frame, that is, clears per-frame variables. | |
| void | calculateProjectionCameraWorldMatrix () |
| Calculates projection * camera * world matrix. | |
| void * | createImageObject (void *dataPointer, int target, int *attributes) |
| Creates an image object, returns NULL if no hardware support. | |
| void | deleteImageObject (void *imageObject) |
| Deletes an image object created with createImageObject. | |
| void | disableSubRectangleProjection () |
| Disables the sub-rectangle of projection. | |
| void | disableWorkaround (Workaround workaround) |
| Disables a renderer workaround. | |
| void | enableWorkaround (Workaround workaround) |
| Enables a renderer workaround. | |
| void | endFrame () |
| Ends rendering a frame, that is, increments frame count. | |
| GraphicsFormat | findValidTextureFormat (GraphicsFormat format, unsigned int features) const |
| Finds a valid texture format that is supported by the graphics adapter and is compatible with a given graphics format. | |
| void | flush () const |
| Flushes the GPU pipeline, forces all commands to be executed in finite time. | |
| SurfaceColorSpace | getActiveColorSpace () const |
| Gets the active color space. | |
| GraphicsOutput * | getActiveGraphicsOutput () const |
| Gets the active graphics output from the renderer. | |
| template<typename Interface > | |
| Interface * | getActiveGraphicsOutput () const |
| Gets the active graphics output from the renderer. | |
| float | getActiveScalar (GraphicsScalar scalar) const |
| Returns a current scalar value from renderer. | |
| SurfaceClientAPI | getActiveSurfaceClientAPI () const |
| BlendStateCache & | getBlendStateCache () |
| Gets the blend state cache. | |
| ColorWorkflow | getColorWorkflow () const |
| Gets the currently configured ColorWorkflow. | |
| CommandRecorder & | getCommandRecorder () |
| Gets the command recorder. | |
| CompositionStack & | getCompositionStack () |
| Returns the render context stack. | |
| GraphicsFormat | getDepthStencilFormatForRenderbuffer (bool depth, bool stencil) const |
| Returns a depth-stencil renderbuffer format that is supported by the renderer. | |
| GraphicsFormat | getDepthStencilFormatForTexture (bool depth, bool stencil) const |
| Returns a depth-stencil texture format that is supported by the renderer. | |
| DepthStencilStateCache & | getDepthStencilStateCache () |
| Gets the depth stencil state cache. | |
| DrawBuffers | getDrawBuffersSupport () const |
| Returns the support for draw buffers. | |
| bool | getDumpStateOnDrawCalls () const |
| Returns current dump state on draw calls setting. | |
| GraphicsFormat | getFallback (GraphicsFormat format, unsigned int usageFlags) const |
| Returns a fallback graphics format that supports given usage flags. | |
| GraphicsFormatFeature | getFeatures (GraphicsFormat format) const |
| Describes the features for which a format can be used in the renderer. | |
| FloatTexture | getFloatTextureSupport () const |
| Returns the support for float texture format. | |
| int | getGlesVersion () const |
| Returns the supported OpenGL ES version. | |
| chrono::milliseconds | getGlobalTime () const |
| Gets the wall clock time in milliseconds since program start. | |
| HalfFloatTexture | getHalfFloatTextureSupport () const |
| Returns the support for half float texture format. | |
| float | getInheritedAspectRatioMultiplier () const |
| Gets the multiplier to inherited aspect ratio. | |
| const optional< gfx::Statistics::Results > & | getLastFrameStatistics () |
| Gets the Kanzi graphics statistics for the previous frame. | |
| bool | getLogging () const |
| Returns whether the logging of OpenGL API calls is enabled. | |
| Matrix4x4 | getMatrix (FixedMatrix matrixType) const |
| Gets a matrix from the renderer. | |
| float | getMaximumAnisotropy () const |
| Gets the maximum anisotropy. | |
| size_t | getMaximumRenderbufferSize () const |
| Gets maximum renderbuffer size. | |
| size_t | getMaximumSampleCount () const |
| Gets maximum sample count for multisampling. | |
| size_t | getMaximumTextureSize (TextureType textureType) const |
| Gets maximum texture side size. | |
| size_t | getMaximumViewportHeight () const |
| Gets maximum viewport height. | |
| size_t | getMaximumViewportWidth () const |
| Gets maximum viewport width. | |
| Multisample | getMultisampleSupport () const |
| Returns the support for multisample textures and renderbuffers. | |
| GraphicsFormat | getNativePixelReadFormat () |
| Gets the native pixel read format from the renderer. | |
| MaterialSharedPtr | getOverrideClusterMaterial (Node *node, MaterialSharedPtr clusterMaterial, size_t clusterIndex) const |
| Gets overriding material for given transformed object node and cluster material. | |
| OverrideMaterialCallback | getOverrideMaterialCallback () const |
| Gets override material callback from renderer or nullptr if not enabled. | |
| void * | getOverrideMaterialCallbackUserData () const |
| Gets override material callback user data from renderer. | |
| ProgramBinary | getProgramBinarySupport () const |
| Returns the support for program binaries. | |
| RasterStateCache & | getRasterStateCache () |
| Gets the raster state cache. | |
| RenderPassArchetypeCache & | getRenderPassArchetypeCache () |
| Gets the render pass archetype cache. | |
| SamplerCache & | getSamplerCache () |
| Gets the sampler cache. | |
| Vector2 | getScreenSize () |
| Gets the current screen size. | |
| VertexInputStateCache & | getVertexInputStateCache () |
| Gets the vertex input state cache. | |
| bool | GPUCallsIsEnabled () const |
| Returns whether GPU calls are enabled. | |
| void | initialize (const RendererSettings &rendererSettings) |
| Initializes the renderer object. | |
| void | invalidateAllocations () |
| Invalidates all handles from the renderer without affecting the GL state. | |
| bool | isHalfFloatVertexAttributeSupported () const |
| Returns whether half-float vertex attribute is supported. | |
| bool | isInitialized () const |
| Returns whether the renderer is initialized. | |
| bool | isSupported (RendererSupport feature) const |
| Returns whether coverage buffer is supported. | |
| bool | isWorkaroundEnabled (Workaround workaround) const |
| Return whether a workaround is enabled. | |
| void | logOpenGLInformation (unsigned int flags) const |
| Logs information about renderer capabilities. | |
| Renderer () | |
| Creates a renderer object. | |
| void | reset () |
| Resets the renderer. | |
| void | resetActiveFramebuffer () |
| Resets the active framebuffer for the renderer to the default (screen). | |
| void | resetFrame () |
| Resets the frame for the core renderer, that is, counters for logging rendering information, such as triangle count. | |
| void | setActiveGraphicsOutput (GraphicsOutput *graphicsOutput) |
| Sets the active surface context for the renderer. | |
| void | setActiveScalar (GraphicsScalar scalar, float value) |
| Switches an scalar value for renderer if necessary, e.g. depth clear value. | |
| void | setColorWorkflow (ColorWorkflow colorWorkflow) |
| Sets the ColorWorkflow that has been configured. | |
| void | setGPUCallsEnabled (bool enabled) |
| Sets GPU calls as enabled or disabled. | |
| void | setImageTargetTexture (TextureType type, void *imageObject) |
| Sets an image object bound to the currently bound texture type. | |
| void | setLogging (bool enabled, bool dumpStateOnDrawCalls) |
| Enables or disables the logging of OpenGL API calls. | |
| void | setMatrix (FixedMatrix matrixType, Matrix4x4 matrix) |
| Sets a matrix for the renderer. | |
| void | setOverrideMaterial (MaterialSharedPtr material) |
| Sets the current override material that Kanzi uses instead of all default materials. | |
| void | setOverrideMaterialCallback (OverrideMaterialCallback callbackFunction, void *userData) |
| Sets override material callback. | |
| void | setScreenSize (Vector2 screenSize) |
| Sets the current screen size. | |
| void | setSubRectangleProjection (RectangleFloat subRectangle) |
| Enables sub-rectangle of what would be the normal projection with the given relative parameters. | |
| void | setWorkaroundEnable (Workaround workaround, bool enabled) |
| Sets workaround enable state to true or false. | |
| bool | supports (GraphicsFormat format, unsigned int features) const |
| Returns whether a graphics format supports given features. | |
| bool | supportsColorAttachment (GraphicsFormat format) const |
| Returns whether the renderer can use a given graphics format as a color attachment in framebuffers. | |
| bool | supportsDepthStencilAttachment (GraphicsFormat format) const |
| Returns whether the renderer can use a given graphics format as a depth-stencil attachment in framebuffers. | |
| bool | supportsRenderbuffer (GraphicsFormat format) const |
| Returns whether the renderer can use a given graphics format as a renderbuffer. | |
| bool | supportsTexture (GraphicsFormat format) const |
| Returns whether the renderer can use a given graphics format as a texture. | |
| void | uninitialize () |
| Uninitializes the renderer object. | |
| ~Renderer () | |
Kanzi legacy renderer interface.
This class is gradually deprecated in favor of kzgfx rendering. The class still serves as a container for CompositionStack and CommandRecorder.
Callback function for override materials.
|
explicit |
Creates a renderer object.
| kanzi::Renderer::~Renderer | ( | ) |
| void kanzi::Renderer::resetFrame | ( | ) |
Resets the frame for the core renderer, that is, counters for logging rendering information, such as triangle count.
| void kanzi::Renderer::reset | ( | ) |
Resets the renderer.
Kanzi calls this function when the renderer is initialized. For example, this function resets the caches and states of the renderer, and syncs the renderer variables with the GL states.
This function is very slow. Instead of calling this function, use the Kanzi rendering functions whenever possible. If you do rendering without calling the Kanzi rendering functions, you can use this function to sync the Kanzi rendering state with the GPU state.
| void kanzi::Renderer::initialize | ( | const RendererSettings & | rendererSettings | ) |
Initializes the renderer object.
Requires a graphics context.
| rendererSettings | Settings structure for initializing the renderer. |
| void kanzi::Renderer::uninitialize | ( | ) |
Uninitializes the renderer object.
| bool kanzi::Renderer::isInitialized | ( | ) | const |
Returns whether the renderer is initialized.
| void kanzi::Renderer::setActiveGraphicsOutput | ( | GraphicsOutput * | graphicsOutput | ) |
Sets the active surface context for the renderer.
| graphicsOutput | The graphics output to use. |
| GraphicsOutput * kanzi::Renderer::getActiveGraphicsOutput | ( | ) | const |
Gets the active graphics output from the renderer.
Gets the active graphics output from the renderer.
| Interface | Interface of the graphics output to query. |
| SurfaceClientAPI kanzi::Renderer::getActiveSurfaceClientAPI | ( | ) | const |
| SurfaceColorSpace kanzi::Renderer::getActiveColorSpace | ( | ) | const |
Gets the active color space.
| void kanzi::Renderer::setActiveScalar | ( | GraphicsScalar | scalar, |
| float | value ) |
Switches an scalar value for renderer if necessary, e.g. depth clear value.
|
inline |
Returns a current scalar value from renderer.
| void kanzi::Renderer::setMatrix | ( | FixedMatrix | matrixType, |
| Matrix4x4 | matrix ) |
Sets a matrix for the renderer.
|
inline |
Gets a matrix from the renderer.
| void kanzi::Renderer::calculateProjectionCameraWorldMatrix | ( | ) |
Calculates projection * camera * world matrix.
| void kanzi::Renderer::resetActiveFramebuffer | ( | ) |
Resets the active framebuffer for the renderer to the default (screen).
| GraphicsFormat kanzi::Renderer::getNativePixelReadFormat | ( | ) |
Gets the native pixel read format from the renderer.
| void kanzi::Renderer::flush | ( | ) | const |
Flushes the GPU pipeline, forces all commands to be executed in finite time.
| bool kanzi::Renderer::GPUCallsIsEnabled | ( | ) | const |
Returns whether GPU calls are enabled.
| bool kanzi::Renderer::isSupported | ( | RendererSupport | feature | ) | const |
Returns whether coverage buffer is supported.
| feature | Feature to check. |
| Multisample kanzi::Renderer::getMultisampleSupport | ( | ) | const |
Returns the support for multisample textures and renderbuffers.
| ProgramBinary kanzi::Renderer::getProgramBinarySupport | ( | ) | const |
Returns the support for program binaries.
| HalfFloatTexture kanzi::Renderer::getHalfFloatTextureSupport | ( | ) | const |
Returns the support for half float texture format.
|
inline |
Returns whether half-float vertex attribute is supported.
| FloatTexture kanzi::Renderer::getFloatTextureSupport | ( | ) | const |
Returns the support for float texture format.
| DrawBuffers kanzi::Renderer::getDrawBuffersSupport | ( | ) | const |
Returns the support for draw buffers.
Creates an image object, returns NULL if no hardware support.
Image object can be bound as texture input. Requires surface to be set for the renderer via setSurface, otherwise throws an error.
Deletes an image object created with createImageObject.
| void kanzi::Renderer::setImageTargetTexture | ( | TextureType | type, |
| void * | imageObject ) |
Sets an image object bound to the currently bound texture type.
| float kanzi::Renderer::getMaximumAnisotropy | ( | ) | const |
Gets the maximum anisotropy.
| size_t kanzi::Renderer::getMaximumTextureSize | ( | TextureType | textureType | ) | const |
Gets maximum texture side size.
| size_t kanzi::Renderer::getMaximumRenderbufferSize | ( | ) | const |
Gets maximum renderbuffer size.
| size_t kanzi::Renderer::getMaximumViewportWidth | ( | ) | const |
Gets maximum viewport width.
| size_t kanzi::Renderer::getMaximumViewportHeight | ( | ) | const |
Gets maximum viewport height.
| size_t kanzi::Renderer::getMaximumSampleCount | ( | ) | const |
Gets maximum sample count for multisampling.
| void kanzi::Renderer::invalidateAllocations | ( | ) |
Invalidates all handles from the renderer without affecting the GL state.
Logs information about renderer capabilities.
|
inline |
Enables a renderer workaround.
|
inline |
Disables a renderer workaround.
|
inline |
Return whether a workaround is enabled.
|
inline |
Sets workaround enable state to true or false.
| GraphicsFormat kanzi::Renderer::findValidTextureFormat | ( | GraphicsFormat | format, |
| unsigned int | features ) const |
Finds a valid texture format that is supported by the graphics adapter and is compatible with a given graphics format.
The returned format must be binary-compatible with the format parameter. For example, input ETC1 format can return ETC2 format.
| format | The format with which the result format should be compatible. |
| features | Usage bits that should be supported by the format. |
| GraphicsFormatFeature kanzi::Renderer::getFeatures | ( | GraphicsFormat | format | ) | const |
Describes the features for which a format can be used in the renderer.
| format | The graphics format. |
| bool kanzi::Renderer::supports | ( | GraphicsFormat | format, |
| unsigned int | features ) const |
Returns whether a graphics format supports given features.
| bool kanzi::Renderer::supportsTexture | ( | GraphicsFormat | format | ) | const |
Returns whether the renderer can use a given graphics format as a texture.
| bool kanzi::Renderer::supportsRenderbuffer | ( | GraphicsFormat | format | ) | const |
Returns whether the renderer can use a given graphics format as a renderbuffer.
| bool kanzi::Renderer::supportsColorAttachment | ( | GraphicsFormat | format | ) | const |
Returns whether the renderer can use a given graphics format as a color attachment in framebuffers.
| bool kanzi::Renderer::supportsDepthStencilAttachment | ( | GraphicsFormat | format | ) | const |
Returns whether the renderer can use a given graphics format as a depth-stencil attachment in framebuffers.
| GraphicsFormat kanzi::Renderer::getFallback | ( | GraphicsFormat | format, |
| unsigned int | usageFlags ) const |
Returns a fallback graphics format that supports given usage flags.
| GraphicsFormat kanzi::Renderer::getDepthStencilFormatForRenderbuffer | ( | bool | depth, |
| bool | stencil ) const |
Returns a depth-stencil renderbuffer format that is supported by the renderer.
| GraphicsFormat kanzi::Renderer::getDepthStencilFormatForTexture | ( | bool | depth, |
| bool | stencil ) const |
Returns a depth-stencil texture format that is supported by the renderer.
| void kanzi::Renderer::advanceGlobalTime | ( | chrono::milliseconds | deltaTime | ) |
Advances the renderer wall clock with time delta.
| deltaTime | Wall clock delta time. |
| chrono::milliseconds kanzi::Renderer::getGlobalTime | ( | ) | const |
Gets the wall clock time in milliseconds since program start.
This time is monotonically increasing and not affected by time zone changes.
| int kanzi::Renderer::getGlesVersion | ( | ) | const |
Returns the supported OpenGL ES version.
The version is encoded into an integer using this formula: major version times 100 plus minor version times ten. For example, value 310 means version 3.1.
| bool kanzi::Renderer::getLogging | ( | ) | const |
Returns whether the logging of OpenGL API calls is enabled.
| bool kanzi::Renderer::getDumpStateOnDrawCalls | ( | ) | const |
Returns current dump state on draw calls setting.
Enables or disables the logging of OpenGL API calls.
| enabled | Whether to enable the logging of OpenGL API calls. |
| dumpStateOnDrawCalls | New dump state on draw calls setting. |
Sets the current screen size.
| screenSize | The screen size in pixels. |
|
inline |
Gets the current screen size.
|
inline |
Gets the blend state cache.
|
inline |
Gets the raster state cache.
|
inline |
Gets the depth stencil state cache.
|
inline |
Gets the command recorder.
|
inline |
Gets the render pass archetype cache.
|
inline |
Gets the sampler cache.
|
inline |
Gets the vertex input state cache.
|
inline |
Returns the render context stack.
|
inline |
Enables sub-rectangle of what would be the normal projection with the given relative parameters.
| subRectangle | Sub-rectangle data. |
|
inline |
Disables the sub-rectangle of projection.
|
inline |
Gets the multiplier to inherited aspect ratio.
| void kanzi::Renderer::applyCameraMatrix | ( | Matrix4x4 | cameraProjectionMatrix, |
| Matrix4x4 | cameraViewMatrix, | ||
| float | near, | ||
| float | far ) |
Applies camera matrices to the renderer so that Kanzi can apply them as uniforms to shaders.
| cameraProjectionMatrix | Camera projection matrix. |
| cameraViewMatrix | Camera view matrix that is already inverted from the camera transform. |
| near | Distance to near plane. |
| far | Distance to far plane. |
|
inline |
Sets the current override material that Kanzi uses instead of all default materials.
Setting material to nullptr disables overrides.
| material | Material to use as override material. |
|
inline |
Sets override material callback.
Pass nullptr to disable.
| callbackFunction | Callback function. |
| userData | User data parameters to callback function. |
|
inline |
Gets override material callback from renderer or nullptr if not enabled.
|
inline |
Gets override material callback user data from renderer.
| MaterialSharedPtr kanzi::Renderer::getOverrideClusterMaterial | ( | Node * | node, |
| MaterialSharedPtr | clusterMaterial, | ||
| size_t | clusterIndex ) const |
Gets overriding material for given transformed object node and cluster material.
| node | Node to get overriding material for. |
| clusterMaterial | Cluster material to use. |
| clusterIndex | Cluster index. |
| void kanzi::Renderer::beginFrame | ( | ) |
Begins rendering a frame, that is, clears per-frame variables.
| void kanzi::Renderer::endFrame | ( | ) |
Ends rendering a frame, that is, increments frame count.
| void kanzi::Renderer::setColorWorkflow | ( | ColorWorkflow | colorWorkflow | ) |
Sets the ColorWorkflow that has been configured.
| colorWorkflow | The project level color workflow. |
| ColorWorkflow kanzi::Renderer::getColorWorkflow | ( | ) | const |
Gets the currently configured ColorWorkflow.
|
inline |
Gets the Kanzi graphics statistics for the previous frame.